<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head>
<!--Converted with LaTeX2HTML 98.1 release (February 19th, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->


<title>500!</title>
<meta name="description" content="500!">
<meta name="keywords" content="htmlatex">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="STYLESHEET" href="acm-00623_archivos/htmlatex.css">
</head><body bgcolor="#ffffff" lang="EN">

<h1><br clear="all"><center><table bgcolor="#0060f0"><tbody><tr><td><b><font size="5" color="#c0ffff">&nbsp;<a name="SECTION0001000000000000000000">
500!</a>&nbsp;</font></b></td></tr></tbody></table></center>
</h1>

<p>
In these days you can more and more often happen to see programs which perform
some useful calculations being executed rather then trivial screen savers.
Some of them check the system message queue and in case of finding it empty
(for examples somebody is editing a file and stays idle for some time) execute
its own algorithm.

</p><p>
As an examples we can give programs which calculate primary numbers.

</p><p>

</p><p>
<br>
One can also imagine a program which calculates a factorial of given numbers.
In this case it is the time complexity of order <i>O</i>(<i>n</i>) which makes troubles,
but the memory requirements. Considering the fact that 500! gives 1135-digit
number no standard, neither integer nor floating, data type is applicable here.

</p><p>

</p><p>
<br>
Your task is to write a programs which calculates a factorial of a given number.

</p><p>

<b>Assumptions:</b> Value of a number ``<i>n</i>" which factorial
should be calculated of does not exceed 1000 (although 500! is the name
of the problem, 500! is a small limit).
</p><p>

</p><h2><font color="#0070e8"><a name="SECTION0001001000000000000000">
Input</a>&nbsp;</font>
</h2>
Any number of lines, each containing value ``<i>n</i>" for which you should provide
value of <i>n</i>!

<p>

</p><h2><font color="#0070e8"><a name="SECTION0001002000000000000000">
Output</a>&nbsp;</font>
</h2>
2 lines for each input case. First should contain value ``<i>n</i>" followed by character `<tt>!</tt>'. The second
should contain calculated value <i>n</i>!.

<p>

</p><h2><font color="#0070e8"><a name="SECTION0001003000000000000000">
Sample Input</a>&nbsp;</font>
</h2>

<p>
</p><pre>10
30
50
100
</pre>

<p>

</p><h2><font color="#0070e8"><a name="SECTION0001004000000000000000">
Sample Output</a>&nbsp;</font>
</h2>
				
<pre>10!
3628800
30!
265252859812191058636308480000000
50!
30414093201713378043612608166064768844377641568960512000000000000
100!
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
</pre>

<p>

</p><p>
<br></p><hr>
<address>
<i>Miguel A. Revilla</i>
<br><i>2000-01-10</i>
</address>
</body></html>